package com.chem.search.controller;


import com.chem.search.entity.ShortPage;
import com.chem.search.mapper.ShortPageMapper;
import com.chem.search.params.ShortPageReq;
import com.chem.search.service.ShortPageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.elasticsearch.core.SearchHits;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 权哥
 * @version 1.0
 * @date 2023/9/14 23:49
 */
@RestController
@RequestMapping("/search")
public class test {

    @Autowired
    private ShortPageService shortPageService;

    @Autowired
    private ShortPageMapper shortPageMapper;

    @PostMapping("/short_page")
    public Page<ShortPage> search(String key){
        return shortPageService.search(key);
    }

    @PostMapping("/searchQuery")
    public Page<ShortPage> searchQuery(@RequestBody ShortPageReq req){
        return shortPageService.searchQuery(req);
    }

    @PostMapping("/searchOrFlag")
    public SearchHits searchOrFlag(@RequestBody ShortPageReq req){
        return shortPageService.searchOrFlag(req);
    }



}
